package com.heima.feign;

import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feign.falback.WemediaFeignFallback;
import com.heima.model.wemedia.pojos.WmNews;
import com.heima.model.wemedia.pojos.WmUser;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "leadnews-wemedia"
                ,fallbackFactory = WemediaFeignFallback.class,
                configuration = HeimaFeignAutoConfiguration.class)
public interface WemediaFeignClient {

    @ApiOperation("保存自媒体用户信息")
    @PostMapping("/api/v1/user/save")
    public ResponseResult<WmUser> save(@RequestBody WmUser wmUser);
    @ApiOperation("根据名称查询自媒体用户信息")
    @GetMapping("/api/v1/user/findByName/{name}")
    public ResponseResult<WmUser> findByName(@PathVariable("name") String name);

    @GetMapping("/api/v1/news/one/{id}")
    public ResponseResult<WmNews> findWmNewsById(@PathVariable("id") Integer id);
    @PostMapping ("/api/v1/news/update")
    ResponseResult updateWmNews(@RequestBody WmNews wmNews);

}